package com.dark.util;

import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;

/**
 * ClassName: Md5Util
 * Description:Md5Util
 *
 * @author chengluchao
 * @date: 2022/9/23 10:06 PM
 * @since 1.0.9
 */
public class MD5Util {

    public static String md5(String text) {
        return md5(text, "");
    }

    public static String md5(String text, String salt) {
        return DigestUtils.md5DigestAsHex((text + salt).getBytes(StandardCharsets.UTF_8));
    }
}
